package com.zzyl.nursing.controller.member;

import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.AjaxResult;
import com.zzyl.common.core.domain.R;
import com.zzyl.nursing.dto.QueryDeviceDataDto;
import com.zzyl.nursing.dto.UserLoginRequestDto;
import com.zzyl.nursing.service.IFamilyMemberService;
import com.zzyl.nursing.vo.LoginVo;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 老人家属Controller
 * 
 * @author ruoyi
 * @date 2025-04-26
 */
@RestController
@RequestMapping("/member/user")
@Api(tags = "老人家属的接口")
public class FamilyMemberController extends BaseController
{
    @Autowired
    private IFamilyMemberService familyMemberService;

    @PostMapping("/login")
    public AjaxResult login(@RequestBody UserLoginRequestDto dto){
        LoginVo vo = familyMemberService.login(dto);
        return success(vo);
    }
    /**
     * 按天统计查询指标数据
     */
    @GetMapping("/queryDeviceDataListByDay")
    public R<List<Map<String, Object>>> queryDeviceDataListByDay(@RequestBody QueryDeviceDataDto queryDeviceDataDto) {
        return R.ok(familyMemberService.queryDeviceDataListByDay(queryDeviceDataDto));
    }
    /**
     * 按周统计查询指标数据
     */
    @GetMapping("/queryDeviceDataListByWeek")
    public R<List<Map<String, Object>>> queryDeviceDataListByWeek(@RequestBody QueryDeviceDataDto queryDeviceDataDto) {
        return R.ok(familyMemberService.queryDeviceDataListByWeek(queryDeviceDataDto));
    }
}
